package com.ruoyi.framework.field;

import cn.hutool.core.text.StrFormatter;
import cn.hutool.extra.spring.SpringUtil;
import com.ruoyi.framework.scanpath.ScanPathUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;

import javax.servlet.http.HttpServletRequest;

@Slf4j
public class RequestsParamCheckHandel {

    private static final String BASE_URL = SpringUtil.getProperty("server.servlet.context-path");

    public static void check(HttpServletRequest request) {
        String url = request.getRequestURI().replace(BASE_URL, "");
        String method = request.getMethod().toUpperCase();
        log.info(StrFormatter.format("url : {} ,method : {} , urlModel : {}", url, method, ScanPathUtils.getOne(url, method)));
    }


}
